import request from '@/utils/request'
import type { EmpModel, EmpQuery, ResultModel, PageBean } from './model/model'

// 分页+条件查询员工
export const getEmpListApi = (params: EmpQuery) =>
  request.get<any, ResultModel<PageBean<EmpModel>>>('/emps', { params })

// 添加员工
export const addEmpApi = (emp: EmpModel) => request.post<any, ResultModel>('/emps', emp)

// 根据ID查询员工
export const getEmpByIdApi = (id: number) => request.get<any, ResultModel<EmpModel>>(`/emps/${id}`)

// 修改员工
export const updateEmpApi = (emp: EmpModel) => request.put<any, ResultModel>('/emps', emp)

// 批量删除员工
export const deleteEmpApi = (ids: number[]) =>
  request.delete<any, ResultModel>(`/emps/${ids.join(',')}`)

// 员工性别统计DTO
export interface GenderCountDTO {
  gender: number
  count: number
}
// 员工职位统计DTO
export interface JobDataCountDTO {
  jobList: string[]
  dataList: number[]
}
// 获取员工性别统计
export const getEmpGenderDataApi = () => request.get<GenderCountDTO[]>('/emps/report/empGenderData')
// 获取员工职位统计
export const getEmpJobDataApi = () => request.get<JobDataCountDTO>('/emps/report/empJobData')
